﻿#region Copyright(C) 2018 FI Ltd. All rights reserved.

// ==================================================================================================
// Copyright(C) 2018 FI Ltd. All rights reserved.
//
// SYSTEM NAME	:   FI.Net Application Framework 
// COMPONENT ID :   FI.EntityFramework
// COMPONENT DESC:  
//
// CREATED DATE/BY: 18 Aug 2018 / Tian Mi
//
// REVISION HISTORY:	DATE/BY			SR#/CS/PM#/OTHERS		DESCRIPTION OF CHANGE
// ==================================================================================================

#endregion

using FI.Core.Utilities;
using System.Collections.Generic;

namespace FI.EntityFramework.Interception
{
    /// <summary>
    /// Represents a sql statement of the delete command.
    /// </summary>
    internal class DeleteCommandStatement
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DeleteCommandStatement"/> class.
        /// </summary>
        /// <param name="schema">The schema name.</param>
        /// <param name="table">The table name.</param>
        /// <param name="deleteCondition">The delete conditions.</param>
        public DeleteCommandStatement(string schema, string table, IEnumerable<CommandClause> deleteCondition)
        {
            Guard.ArgumentNotNullOrEmpty(schema, "schema");
            Guard.ArgumentNotNullOrEmpty(table, "table");
            Guard.ArgumentNotNull(deleteCondition, "deleteCondition");

            this.Schema = schema;
            this.Table = table;
            this.DeleteCondition = deleteCondition;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="DeleteCommandStatement"/> class.
        /// </summary>
        /// <param name="schema">The schema name.</param>
        /// <param name="table">The table name.</param>
        /// <param name="deleteCondition">The delete conditions.</param>
        /// <param name="updateCondition">The update conditions.</param>
        /// <param name="updateContent">Content of the update.</param>
        public DeleteCommandStatement(string schema, string table, IEnumerable<CommandClause> deleteCondition, IEnumerable<CommandClause> updateCondition, IEnumerable<CommandClause> updateContent)
            : this(schema, table, deleteCondition)
        {
            Guard.ArgumentNotNull(updateCondition, "updateCondition");
            Guard.ArgumentNotNull(updateContent, "updateContent");

            this.UpdateCondition = updateCondition;
            this.UpdateContent = updateContent;
        }

        /// <summary>
        /// Gets the table schema.
        /// </summary>
        /// <value>
        /// The table schema.
        /// </value>
        public string Schema
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the table name.
        /// </summary>
        /// <value>
        /// The table name.
        /// </value>
        public string Table
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the delete conditions.
        /// </summary>
        /// <value>
        /// The delete conditions.
        /// </value>
        public IEnumerable<CommandClause> DeleteCondition
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the update conditions.
        /// </summary>
        /// <value>
        /// The update conditions.
        /// </value>
        public IEnumerable<CommandClause> UpdateCondition
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the content of update.
        /// </summary>
        /// <value>
        /// The content of update.
        /// </value>
        public IEnumerable<CommandClause> UpdateContent
        {
            get;
            private set;
        }
    }
}